import 'package:flutter/material.dart';
import 'package:fstudy/src/presentation/pages/chat/chat.dart';
import 'package:fstudy/src/presentation/providers/dify.dart';
import 'package:fstudy/src/presentation/widgets/dify.dart';
import 'package:provider/provider.dart';

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(
          create: (_) => ConversationItemsProvider()..loadData(),
        ), // 会话列表
        ChangeNotifierProvider(
          create: (_) => CurrentConversationProvider(),
        ), // 当前会话ID
      ],
      child: Scaffold(
        body: LayoutBuilder(
          builder: (BuildContext context, constraints) {
            return Scaffold(
              appBar: AppBar(
                title: Text("AI助手"),
                backgroundColor: Colors.blue[700],
              ),
              body: ChatPage(),

              drawer: Drawer(
                child: MediaQuery.removePadding(
                  context: context,
                  removeTop: false,
                  child: ConversationList(),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}
